package com.my.main;

import com.my.Config.RootConfig;
import com.my.bean.User;
import com.my.dao.UserRepository;
import com.my.utils.ApplicationContextutils;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.List;

public class jpaText {


      @Test
        public void text(){
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(RootConfig.class);

        UserRepository userRepository = applicationContext.getBean(UserRepository.class);

        List<User> 张三 = userRepository.getUserByUsername("张三");

        for (User user : 张三) {

          System.out.println(user);
        }

      }

}
